{% extends "base.html" %}

{% block content %}
<p id="header">
	{% for k, v in headers %}
		{% if 'strong' in v.display %}
			<strong>
		{% endif %}
		<span>{{ k }}</span>{{ v.text }}
		{% if 'strong' in v.display %}
			</strong>
		{% endif %}
		<br />
	{% endfor %}
</p>

{% if attachments.0 is not none %}
	<table id="attachments">
		<caption>Attachments</caption>
		<thead>
			<tr>
				<th class="size">Size</th>
				<th class="mime">Mime</th>
				<th class="name">Name</th>
				<th>Download</th>
				<th>View</th>
			</tr>
		</thead>

		<tbody>
			{% for a in attachments %}
				{% set link = phpself ~ '?mime=' ~ a.mime ~ '&uid=' ~ uid ~ '&attachment=' ~ a.partno ~ '&name=' ~ a.name ~ '&tenc=' ~ a.encoding %}

				<tr>
					<td class="size">{{ a.size }}</td>
					<td class="mime">{{ a.mime }}</td>
					<td class="name">{{ a.name }}</td>
					<td><a href="{{ link }}">Download</a></td>
					{% if a.view == 1 %}
						<td><a href="{{ link }}&amp;view=True">View</a></td>
					{% else %}
						<td>&nbsp;</td>
					{% endif %}
				</tr>
			{% endfor %}
		</tbody>
	</table>
{% endif %}

<p id="body">{{ body|raw }}</p>

{% endblock %}

{% block afterjs %}

{% if markasread %}
	<script>
		MarkAsRead('{{ uid }}', {{ markasread }});
	</script>
{% endif %}

{% endblock %}
